/* 异步路由 */
import Index from '../layout/Index.vue'
import Dashboard from '../views/Dashboard/index.vue'
export const asyncRouter = {
  path: '/',
  name: 'Index',
  component: Index,
  redirect: '/dashboard',
  children: [
    // 后台首页
    {
      path: '/dashboard',
      component: Dashboard,
      meta: { title: '首页', icon: 'icon-shouye', name: '首页' }
    },
    // 订单管理
    {
      path: '/orders',
      meta: { title: '订单管理', name: '订单管理', icon: 'icon-icon-' },
      redirect: '/orders/list',
      component: () =>
        import(/* webpackChunkName: "orders" */ '../views/Orders'),
      children: [
        /* 订单列表 */
        {
          path: '/orders/list',
          meta: { title: '订单列表', name: '订单列表' },
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName: "orderslist" */ '../views/Orders/list.vue'
            )
        },
        {
          path: '/orders/edit',
          meta: { title: '订单修改', name: '订单修改' },
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName: "ordersedit" */ '../views/Orders/edit.vue'
            )
        }
      ]
    },
    // 商品管理
    {
      path: '/goods',
      redirect: '/goods/list',
      meta: { title: '商品管理', name: '商品管理', icon: 'icon-shangpin' },
      component: () =>
        import(/* webpackChunkName: "goods" */ '../views/Goods/index.vue'),
      children: [
        /* 商品列表 */
        {
          path: '/goods/list',
          meta: { title: '商品列表', name: '商品列表' },
          component: () =>
            import(
              /* webpackChunkName: "goodslist" */ '../views/Goods/List.vue'
            )
        },
        /* 商品添加 */
        {
          path: '/goods/add',
          meta: { title: '商品添加', name: '商品添加' },
          component: () =>
            import(/* webpackChunkName: "goodsadd" */ '../views/Goods/Add.vue')
        },
        /* 商品分类 */
        {
          path: '/goods/cate',
          meta: { title: '商品分类', name: '商品分类' },
          component: () =>
            import(
              /* webpackChunkName: "goodscate" */ '../views/Goods/Cate.vue'
            )
        },
        /* 商品修改 */
        {
          path: '/goods/edit',
          meta: { title: '商品修改', name: '商品修改' },
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName: "goodsedit" */ '../views/Goods/Goodsedit.vue'
            )
        }
      ]
    },
    /* 店铺管理 */
    {
      path: '/store',
      meta: {
        title: '店铺管理',
        name: '店铺管理',
        icon: 'icon-dianpu',
        role: ['super']
      },
      component: () =>
        import(/* webpackChunkName: "store" */ '../views/Store/index.vue')
    },
    /* 账号管理 */
    {
      path: '/account',
      redirect: '/account/list',
      meta: {
        title: '账号管理',
        name: '账号管理',
        icon: 'icon-yonghu',
        role: ['super', 'normal']
      },
      component: () =>
        import(
          /* webpackChunkName: "accountlist1" */ '../views/Account/index.vue'
        ),
      children: [
        {
          path: '/account/list',
          meta: { title: '账号列表', name: '账号列表', role: ['super'] },
          component: () =>
            import(
              /* webpackChunkName: "accountlist" */ '../views/Account/List.vue'
            )
        },
        {
          path: '/account/add',
          meta: { title: '账号添加', name: '账号添加', role: ['super'] },
          component: () =>
            import(
              /* webpackChunkName: "accountadd" */ '../views/Account/Add.vue'
            )
        },
        {
          path: '/account/reset',
          meta: { title: '账号修改', name: '账号修改' },
          component: () =>
            import(
              /* webpackChunkName: "accountreset" */ '../views/Account/Reset.vue'
            )
        }
      ]
    },
    /* 销售统计 */
    {
      path: '/count',
      redirect: '/count/goods',
      meta: {
        title: '销售统计',
        name: '销售统计',
        icon: 'icon-tongji',
        role: ['super']
      },
      component: () =>
        import(/* webpackChunkName: "orders" */ '../views/Count/index.vue'),
      children: [
        {
          path: '/count/goods',
          meta: { title: '商品统计', name: '商品统计' },
          component: () =>
            import(/* webpackChunkName: "orders" */ '../views/Count/Goods.vue')
        },
        {
          path: '/count/orders',
          meta: { title: '订单统计', name: '订单统计' },
          component: () =>
            import(/* webpackChunkName: "orders" */ '../views/Count/Orders.vue')
        }
      ]
    },
    /* 个人中心 */
    {
      path: '/mine',
      meta: { title: '个人中心', name: '个人中心' },
      hidden: true,
      component: () => import(/* webpackChunkName: "orders" */ '../views/mine')
    }
  ]
}
